import { useDetail, useList } from "@/hooks";
import { getUserInfoUrl } from "@/command/apiTool";
import { getAction, postAction } from "@/command/netTool";
import * as vant from "vant";
const { showFailToast, showSuccessToast } = vant;
import { useRouter, useRoute } from "vue-router";
export const useRequest = () => {
  const router = useRouter();
  const route = useRoute();
  const confirm = (params: any) => {
    let queryParams = {
      ...params,
      leadId: route.query.id,
      isPublic: params.isPublic ? "0" : "1",
    };
    console.log("eee", queryParams);
    postAction(
      "/api/H5/skill/product/small/seedApply",
      { ...queryParams },
      { isResolve: true }
    ).then((e) => {
      showSuccessToast(e.msg || e.data);
      router.back();
    });
  };
  const [productList] = useDetail("/api/H5/util/getProductLevel", [], {
    callBack: (data: any[]) => {
      return data.filter((e) => e.value != "-1");
    },
  });
  return {
    confirm,
    productList,
  };
};
